Ext.define('extjs6test.view.core.JurisdictionEditWindowController', {
    extend: 'extjs6test.view.base.BaseEditWindowController',
    alias: 'controller.juriewc',
    onOkButtonClick: function (button, evt) {
        var win = this.getView();
        var formStore = win.formStore;
        var form = win.down('form');
        if (form.isValid()) {
            form.updateRecord();
            var record = form.getRecord();
            formStore.add(record);
            // formStore.sync();

            var isContinue = form.down('checkbox[name="isContinue"][value=true]');
            if (!isContinue) {
                win.close();
            }
            else {
                if (win.formRecord)
                    form.loadRecord(win.formRecord);
                isContinue.setValue(true);
            }
        }
    }
});